UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C3t4ZG/57mcOFBi5Q3ZR7jLF4CN4hR7NTzMJqWUSoPo=' 
WHERE 
  key_id = 'a5c2731ba75347acb374d2255a12512c1846ec4c5ef8f9f5d687bda69705bbe7' 
  AND (
    token = 'C3t4ZG/57mcOFBi5Q3ZR7jLF4CN4hR7NTzMJqWUSoPo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037