UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rlj1m9YOV2oCRMS6isfpkvu7AqlGEKt2fD2DskILRnE=' 
WHERE 
  key_id = '56c3d25d65e0ad3354c36aa8f0208506862e759c6f7ece8cb7f092e4fb7b0850' 
  AND (
    token = 'rlj1m9YOV2oCRMS6isfpkvu7AqlGEKt2fD2DskILRnE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037