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

Query time 0.00035