UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QDZ9CV5p05a1cp4pQKW5i2ZtJ0qwTVfiNz2JZqGOwsI=' 
WHERE 
  key_id = '0be6d4958ead017e5698916c12b8a4788dbcf51b19ed473e4278a3317ec62554' 
  AND (
    token = 'QDZ9CV5p05a1cp4pQKW5i2ZtJ0qwTVfiNz2JZqGOwsI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026