UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+fKN38ZMDMFL/I9bltmDT+cAM0au9DlWVwrVfziFad0=' 
WHERE 
  key_id = '985076f4c8ff95f087606434595a27d6b06a3b97e0251fe39a3baa519cb07e9a' 
  AND (
    token = '+fKN38ZMDMFL/I9bltmDT+cAM0au9DlWVwrVfziFad0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038