UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cTyp8quoHU6olE3P4X7Wqu/wPiMxcdLAGi27Uj0Z52M=' 
WHERE 
  key_id = 'a833dcfe5f0253b117e81fc10701fc6b1e8631458b8279c44a6a2c3136a4ae7f' 
  AND (
    token = 'cTyp8quoHU6olE3P4X7Wqu/wPiMxcdLAGi27Uj0Z52M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030