UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gVn9Nz2/MHiVi/erK8HLSxcHydnlZRm36iSn/DOxc30=' 
WHERE 
  key_id = '6cae2e609b875aaf55c3883199e4d113de749cce7763f16aaa3e4fd7f5ff0504' 
  AND (
    token = 'gVn9Nz2/MHiVi/erK8HLSxcHydnlZRm36iSn/DOxc30=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027