UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kFlxTZwVURuainBEViuPg0IF+Lnt6vp0e49dh0x9dOw=' 
WHERE 
  key_id = '9149db75b5e6228115f8b123a4919b1db137314e46d34aceab14d0a7878cfe24' 
  AND (
    token = 'kFlxTZwVURuainBEViuPg0IF+Lnt6vp0e49dh0x9dOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035