UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EKHj0TXm0dtSRPnYKLa9eUlt3fNo/U/gdWrLTc6Vvu4=' 
WHERE 
  key_id = '320b30be901d67a0fc19382a6e3b07217fb796fac3475862658e77ec90ed9ffb' 
  AND (
    token = 'EKHj0TXm0dtSRPnYKLa9eUlt3fNo/U/gdWrLTc6Vvu4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018