UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SXn6OY2Lq3dK0BULmuKnEKce3yS2c5JUhrpVyHf2tSI=' 
WHERE 
  key_id = '486d47a0629b9e33d59d284d8f47905a22952c76639a96ea682fa5c072a74300' 
  AND (
    token = 'SXn6OY2Lq3dK0BULmuKnEKce3yS2c5JUhrpVyHf2tSI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039