UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J8wLz1QvKHZsf0ntLLFc1zOVZosgdscdnM8GJW5nJLE=' 
WHERE 
  key_id = '9c339f82b194877674b0be53e4f70d15618ab3bcd40249d17fc6bf16f31db931' 
  AND (
    token = 'J8wLz1QvKHZsf0ntLLFc1zOVZosgdscdnM8GJW5nJLE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023