UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zgeX/NTzqg+noKwIIdjBmXeEM1qNaOJrY7OL2tkOR9c=' 
WHERE 
  key_id = 'dda406ec29d311dc2160810410ea5608139f5ea70cc994097b8f627a06f5a736' 
  AND (
    token = 'zgeX/NTzqg+noKwIIdjBmXeEM1qNaOJrY7OL2tkOR9c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048