UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NJmtBI+GO4I6bDOFLPmr67itLXjpZ34SONlDA30CTjM=' 
WHERE 
  key_id = '19bcde5be965a256a7e33b323026b1e21f426f6ecb388e5ae1b3f52825f85058' 
  AND (
    token = 'NJmtBI+GO4I6bDOFLPmr67itLXjpZ34SONlDA30CTjM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032