UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tSu0iWFLQfDRP1Sw4X8zm27R6s8hp769UlW8hjbzicQ=' 
WHERE 
  key_id = 'd539f6066d71715df1b801a32da32579c9b49907e11ecfaad56c2798cd3030fc' 
  AND (
    token = 'tSu0iWFLQfDRP1Sw4X8zm27R6s8hp769UlW8hjbzicQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045