UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BTEnpXnUM17j+ari93SGUwlz8xoQ9v78hPF4/OkWlUM=' 
WHERE 
  key_id = '3f93706fd78b29fdeeff6edafb182f3aa95008f9349037d3a00ce038f735ee56' 
  AND (
    token = 'BTEnpXnUM17j+ari93SGUwlz8xoQ9v78hPF4/OkWlUM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025