UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ijThSROfOuLsk02iIdqQDhlazR1TGsATPj2JeL1TPu0=' 
WHERE 
  key_id = '625e7e7b9a8f6295da5051622d7606199fea8867392cb0de09202c569a20bfe7' 
  AND (
    token = 'ijThSROfOuLsk02iIdqQDhlazR1TGsATPj2JeL1TPu0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045