UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4Hvzfa4yP9vtoqsRZqZtM0NzvVBMK2wein+dxUs46WI=' 
WHERE 
  key_id = '6198e76d6fc5070e79477eee657a2edb21b5de200f3d3aaea487daee2f66c603' 
  AND (
    token = '4Hvzfa4yP9vtoqsRZqZtM0NzvVBMK2wein+dxUs46WI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037