UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ittrobglQqZUAhjQihR3y974JzvScIMW98+5/UN3GJ4=' 
WHERE 
  key_id = '3662bfe0ccd76eb38be5603b31d4e772e53f7d8e561784678fb00f3eca8dbd97' 
  AND (
    token = 'ittrobglQqZUAhjQihR3y974JzvScIMW98+5/UN3GJ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023