UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U4gwsxD3biuD2RYceEjwQEtsy+OArBdL4mn/XDNfU8E=' 
WHERE 
  key_id = '2ac14d2a8201e7b84da108a0b516603e3b567e54097ac525b0056de63a6d18e4' 
  AND (
    token = 'U4gwsxD3biuD2RYceEjwQEtsy+OArBdL4mn/XDNfU8E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038