UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DimdLzQC8UULPtUawIlw/pwZZWndsmd3rDSOQVCWUQk=' 
WHERE 
  key_id = '2ef3a7239c1c696d10fae8d5ce2d66f9afd8fcf235b560df3e53e3ed69dcdc14' 
  AND (
    token = 'DimdLzQC8UULPtUawIlw/pwZZWndsmd3rDSOQVCWUQk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043