UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qBUQLh8i+FNbd9nQQSQiIiry4MthXmA3EiZOXyHHq6Y=' 
WHERE 
  key_id = '7e968f37caba1288ad0071d825862c857666b68ba2acebec41a602f27244f024' 
  AND (
    token = 'qBUQLh8i+FNbd9nQQSQiIiry4MthXmA3EiZOXyHHq6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046