UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f+GLDsUBt1ondBbvuFFcd/51ozlx9AIUCt+/VaUqoLc=' 
WHERE 
  key_id = 'ec2048ffc14791f45c263e646299c2af8813671f6b3c8ac7d4ad5c7c13cf7968' 
  AND (
    token = 'f+GLDsUBt1ondBbvuFFcd/51ozlx9AIUCt+/VaUqoLc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023