UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'orCngUBachDJondvtaPi+bcCDrG0VGM/lZa0mStzFdE=' 
WHERE 
  key_id = '8f71e673f2fc1209c126ee06bf7d1c40c3ebcc5b47485ec6f2b0959e28efbe48' 
  AND (
    token = 'orCngUBachDJondvtaPi+bcCDrG0VGM/lZa0mStzFdE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035