UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BfDM1+9a//JDwhEMS+RVAHzLJgTFOAdU8P1+DKRKuhA=' 
WHERE 
  key_id = '9cc9fd2d072591d4aa266e63691881b4601563120fa8fa8631a37bf780706c4a' 
  AND (
    token = 'BfDM1+9a//JDwhEMS+RVAHzLJgTFOAdU8P1+DKRKuhA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027