UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ghmaBztP6e+FOAG43TNcrQaGRLkzJciydYF66iQ0mm4=' 
WHERE 
  key_id = '1ea38680eec5ef256cbcdfc5ba5ae9b6ae05e6bd29893803e63464819a257320' 
  AND (
    token = 'ghmaBztP6e+FOAG43TNcrQaGRLkzJciydYF66iQ0mm4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045