UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XUPMwX35QTh5R8RD6y4UQiqFvxPB4olXh43AiXXqYXU=' 
WHERE 
  key_id = '8b660be3fef932c1aa9b3d1e29444d03f929a25c7a6ae9685ead77e20167f385' 
  AND (
    token = 'XUPMwX35QTh5R8RD6y4UQiqFvxPB4olXh43AiXXqYXU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036