UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TawNb/4TK31cbrW1Kse1H4fo3ISnRecVN2VDhTgtei0=' 
WHERE 
  key_id = '5d332080a8e67913d4e2f545fc32e4556f89a3e388f5bb621948d4a190bff0d0' 
  AND (
    token = 'TawNb/4TK31cbrW1Kse1H4fo3ISnRecVN2VDhTgtei0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025