UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bby8jtaQDipUKC2MNCEAK4KrFL5RgIi2spASAd4eDqM=' 
WHERE 
  key_id = '8e8d61ffe1c827fe8586f1e48bf341b7261b8ce65d56425fa9c76000dfacd52e' 
  AND (
    token = 'bby8jtaQDipUKC2MNCEAK4KrFL5RgIi2spASAd4eDqM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037