UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QBC173RNhHDlgDwZQug00JU4HwI9AqX8AkERJG23GiA=' 
WHERE 
  key_id = '39da49d026528b6c84a1e62fdd9b7aa037bd3bb76f6132a2892535a5ad74f941' 
  AND (
    token = 'QBC173RNhHDlgDwZQug00JU4HwI9AqX8AkERJG23GiA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036