UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cn2Wu8Z91pLb6E/00tYceTqhO/ELfgbPX7iSM9Df3d0=' 
WHERE 
  key_id = 'fcbc8d6bf0e4e2ceb48444661fba741bc31038ae0c802168387fc21eb26ee427' 
  AND (
    token = 'cn2Wu8Z91pLb6E/00tYceTqhO/ELfgbPX7iSM9Df3d0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017