UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cQECb7OjgIw24SQbJlmdBG0bkLjiw0nObzKJrFUTJOg=' 
WHERE 
  key_id = '2df24c94107f30843ae4b0be0246cfa2512af5968cf56ea2f94224703b97f68d' 
  AND (
    token = 'cQECb7OjgIw24SQbJlmdBG0bkLjiw0nObzKJrFUTJOg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034