UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1Dlq9fHHBBJ3I0isdZAMU7K3DU0vYFM0X+juWqrCJgw=' 
WHERE 
  key_id = 'a2fa86a739773f0920ded7193181dce43f7791f108cb82cc9885e9e0cd65c746' 
  AND (
    token = '1Dlq9fHHBBJ3I0isdZAMU7K3DU0vYFM0X+juWqrCJgw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016