UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Na/xhsRw4q9qbLY4MFhm4j7Z/37iS5iXdj7TqTFjsEU=' 
WHERE 
  key_id = '3d29ddaddf88791349802eb8a76cbb90ca72311d27344c414c576858d76784b2' 
  AND (
    token = 'Na/xhsRw4q9qbLY4MFhm4j7Z/37iS5iXdj7TqTFjsEU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034