UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i8AKPu1kRhh9gVGdBYZ+aiDg7c/CreKWCsXKbHwN4YE=' 
WHERE 
  key_id = '67e1be2d55152e5d952b96fc1fbee5e942ace536ef38a5b4e3e2005cac950fa4' 
  AND (
    token = 'i8AKPu1kRhh9gVGdBYZ+aiDg7c/CreKWCsXKbHwN4YE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030