UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vk6JnK5ASma+XlhOg/OyKmroV/y1XnFHveF5rfqXWsE=' 
WHERE 
  key_id = 'f338ca5e2459f93302faaf5ae92e62d01b38811fb18d6146cb8c585e9bbb065f' 
  AND (
    token = 'vk6JnK5ASma+XlhOg/OyKmroV/y1XnFHveF5rfqXWsE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034